/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cratos.xxgramoss.base;

import java.lang.annotation.*;

/**
 *
 * @author admin
 */
public class Services {

    private Services() {
        throw new Error();
    }

    //----------------------------------------------操作ID-----------------------------------------------------------
    @ActionName("查询")
    public static final int ACTION_QUERY = 1001;

    @ActionName("新增")
    public static final int ACTION_CREATE = 1002;

    //修改、预览和同步文件
    @ActionName("修改")
    public static final int ACTION_UPDATE = 1003;

    @ActionName("删除")
    public static final int ACTION_DELETE = 1004;

    @ActionName("登录")
    public static final int ACTION_LOGIN = 1010;

    @ActionName("同步")
    public static final int ACTION_SYNC = 1020;

    @ActionName("配置")
    public static final int ACTION_CONFIG = 1030;

    //----------------------------------------------模块ID  注意: @ModuleName名称尽量控制在5个汉字以内-----------------------------------------------------------
    @ModuleName("账号管理")
    public static final int MODULE_MEMBER = 1001;

//    @ModuleName("权限管理")
//    public static final int MODULE_AUTH = 1002;

    @ModuleName("角色管理")
    public static final int MODULE_ROLE = 1003;

    //-----------------------------------------------------平台通用模块--------------------------------------------------------------------------------------------------------
    @ModuleName(value = "用户管理")
    public static final int MODULE_USER = 2001;
    
    @ModuleName(value = "群组管理")
    public static final int MODULE_GROUP = 2002;
    
    @ModuleName(value = "系统公告")
    public static final int MODULE_ANNOUNCE = 2003;
    
    @ModuleName(value = "举报管理")
    public static final int MODULE_COMPLAINT = 2004;
    
    @ModuleName(value = "概况")
    public static final int MODULE_MONITOR = 2005;

    @ModuleName(value = "单聊记录")
    public static final int MODULE_CHATRECORD = 2006;
    

    // -------------------------------------------------------------------------------------------------------------------
    /**
     * 将模块ID与操作ID合并成一个int值
     *
     * @param moduleid
     * @param actionid
     *
     * @return
     */
    public static int optionid(int moduleid, int actionid) {
        return moduleid * 10000 + actionid;
    }

    @Target(value = {ElementType.FIELD})
    @Retention(value = RetentionPolicy.RUNTIME)
    public @interface ModuleName {

        String value();

        boolean parent() default false; // 是否父模块

        String actions() default "1001, 1002, 1003, 1004";
    }

    @Target(value = {ElementType.FIELD})
    @Retention(value = RetentionPolicy.RUNTIME)
    public @interface ActionName {

        String value();
    }

    @Target(value = {ElementType.FIELD})
    @Retention(value = RetentionPolicy.RUNTIME)
    public @interface TypeName {

        String value();
    }
}
